package com.lanjiyin.cloud.generator.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanjiyin.cloud.common.msg.Result;


@Controller
public class LoginController {
    
    @GetMapping("login")
    public String login() {
        return "login";
    }
    
    
    
    @PostMapping("login")
    @ResponseBody
    public Result<Object> login(String username,String password){
        if("admin".equals(username)) {
            System.out.println("userName："+username);
            System.out.println("password:"+password);
            return new Result<>(200,"登录成功");
            
        }
        if("tudaojun".equals(username)) {
            System.out.println("userName："+username);
            System.out.println("password:"+password);
            return new Result<>(500,"登录错误");
        }
        System.out.println("userName："+username);
        System.out.println("password:"+password);
      return  null;
    }
    
}
